<%= render 'menu/caidau'%>
<p style="color: red"><%= label_tag params[:alert] %></p>
<p style="color: green"><%= label_tag params[:alert1] %></p>
<table>
	<tr>
		<td><%= image_tag(('img/'+@showitem.id.to_s+'.jpg').to_s,:width=>'300px', :id=>"image" )%> </td>
		<td valign="top">
			<fieldset align="left">
			<legend><h2>Book Details</h2></legend>
			
			<table>
				<tr>
					<td colspan="2">
						<%=
							if (@likeme.nil?)
								link_to 'Like', {:action=>'like'}
							else
								link_to 'Unlike', {:action=>'unlike'}
							end
						%>
					</td>
				</tr>	
				<tr>
					<td>Name</td>
					<td>: <%= @showitem.Name %></td>
				</tr>
				<tr>
					<td>Author</td>
					<td>: <%= @showitem.Author%></td>
				</tr>
				<tr>
					<td>Genre</td>
					<td>: <%= @showitem.Genre%></td>
				</tr>
				<tr>
					<td>Publish</td>
					<td>: <%= @showitem.Publish_year %></td>
				</tr>
				<tr>
					<td>Quantity</td>
					<td>: <%= @showitem.Quantity %></td>
				</tr>
				<tr>
					<td>Available quantity</td>
					<td>: <%= @showitem.Available_quantity %></td>
				</tr>
				<tr>
					<td>Description</td>
					<td>: <%= @showitem.Description %></td>
				</tr>
				<tr>
					<td>People liked this</td>
					<td>: <%=@s%></td>
				</tr>
			</table>
			

			<%= form_tag :action => "order_process" do%>
				<%= hidden_field_tag 'id', @showitem.id%>
				<%= hidden_field_tag 'avail', @showitem.Available_quantity%>
				<%= submit_tag "Order"%>
			<% end %>
			<%= link_to 'Back', second_path%>
			</fieldset>
			
		</td>	
		
		<td>
			<fieldset align="left">
			<legend><h2>Comments</h2></legend>
			<% if (!@comment.nil?)%>
				<%@comment.each do |cm|%>
			<strong><%= User.find_by_id(cm.Uid).Username %>: </strong> <%= cm.Content%> </br>
			
			<% end %>
			
			<%end%>  
						
			<%= form_tag :action => "sendcomment" do%>
			 	<%= text_field_tag 'noidung'%> <br/>
				<%= submit_tag 'Comment'%>
			<%end%>
			
			</fieldset>
		</td>
	</tr>	
</table>
